Repository navigation
Conversation
…he list A list that starts with the bytes EF BB BF lost its first file. The mark stayed in front of the first path, so that path named no file and the run passed it over. With other paths in the list, the exit code was 0. Cut the mark before the list is split into lines. `bun pm pack` does the same for .npmignore and .gitignore.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Updated 3:05 PM PT - Nov 8th, 2026
❌ @robobun, your commit abc57e2 has some failures in 🧪 To try this PR locally: bunx bun-pr 48257That installs a local version of the PR into your bun-48257 --bun |
|
Status: ready for review. The diff is green on every CI lane that ran. CI at abc57e2 (build 138829, finished 23:05 UTC on 8 November). The build is marked failed for one reason: the 4 macOS x64 test shards never ran. They waited 5 hours for an agent, expired 4 times, and the automatic retries ran out. No job failed on a test: 184 of 188 jobs passed. How I reproduced it. On main 2596ac5 (a debug build, a local release build, and the canary build 1.4.4-canary.1+2596ac5d3), a list that starts with the bytes for t in a b c; do printf 'import { test, expect } from "bun:test";\ntest("in %s", () => { expect(1).toBe(1); });\n' $t > $t.test.ts; done
printf '\xef\xbb\xbf./a.test.ts\n./b.test.ts\n./c.test.ts\n' > list.txt
bun test --files-from=./list.txtWith this change the same list runs a, b and c. Of the 7 new tests in PR: #48257 |
…-from list An unmarked list whose first line is a bare name that starts with U+FEFF reads as a marked list. The way to list such a file is `./` before the name. Hold that form in a test, beside the later-line case.
Problem
bun test --files-fromskips the first file of a list that starts with a UTF-8 byte order mark (EF BB BF), and exits 0. A list of that one line printsTest filter "./\uFEFF./a.test.ts" had no matches.append_test_files_from(src/runtime/cli/Arguments.rs:67) splits the raw bytes, so the first path is./<mark>./a.test.ts.bun testpasses over a missing path when other paths exist.Fix
strings::without_utf8_bombefore the split. Only the first three bytes of each list are a mark.test/cli/test/files-from.test.ts: 6 of 7 new tests fail on main 2596ac5, all pass with the change. Also ran the file with--aotchild runs.Background
--files-fromreads test file paths from a file, one per line (AOT: bun test --aot on large suites, module loading fixes, fuzzer fixes #47316, in no release). Windows PowerShell 5.1 writes the mark with-Encoding utf8.bun pm packmakes this cut for.npmignore(pack_command.rs:2914, pack: skip a UTF-8 BOM at the start of .npmignore and .gitignore #41871).Downsides
./before it.lists no test files.arguments::parsegrows 48 bytes.Notes
Repro
./a,./b,./c(also bare names, also CRLF)Test filter "./\uFEFF./a.test.ts" had no matches, exit 1Test filter "./\uFEFF" had no matches, exit 1lists no test files, exit 1I ran the repro on a debug build of main, on a local release build of main, and on the canary build 1.4.4-canary.1+2596ac5d3.
Tests
--files-from skips a UTF-8 byte order mark at the start of the list: four lists (paths, names with CRLF, an absolute first path, two lists). Each has an unlisted file that must not run.a list that holds only a byte order mark lists no test files.U+FEFF after the start of the list is a character of the name: two lists. The first holds the mark,a.test.js, then a file whose name really starts with U+FEFF. Both run. The second has no mark and lists that file with./before the name. It passes on main too. These tests state the rule that only byte 0 is a mark, and hold the./form.bun testchild processes at once take more than 5 seconds each.test/aot/fuzz/grids/runner-suites-flags.tsruns this file with--aotchild runs. Itsfiles-fromshare passes with a release build of this PR and fails with a release build of main.test/cli/run/run-unicode.test.tsalready uses U+200B in paths on all platforms.Measurements
Two local release builds from one toolchain and one build directory: main 2596ac5, and the same tree with this change.
bun test unit --files-from=big.txt): medians 926,136 and 926,138instructions:uover 5 interleaved runs. The spread within one build is 7 to 13, so the delta of 2 is below the noise.objdumpofbun_runtime::cli::arguments::parse, where the function is inlined): 10 instructions (4 compares, 4 branches, 2 adds). An unmarked list runs 4 of them../prefix.sizereports text 137,931,057, data 124,128, bss 1,861,880 for both builds.nm -S:arguments::parse25,874 to 25,922 bytes. It is the only one of 191,938 symbols whose size differs. No symbol is added.mi_malloc3,076,mi_realloc12,mi_zalloc3, on both builds, for the unmarked and the marked list.parsehas 462 call instructions in both builds.catch syscall): the marked 3-file list makes 1openatwith the mark in the path on main and 0 with this PR.openatona.test.ts: 0 to 3. Totalopenat: 25 to 27, equal to the unmarked control. The parse-only run makes 95 syscalls on both builds.x.test.tsif it exists, else passes the line over (2 files to 1, exit 0). With./on line 1: no change. Bare on line 2: no change.bun testchild processes infiles-from.test.ts(8 before), about 2 seconds in a debug build.--shardmembership changes for a marked list, because the list has one more file. With four files, shard 1/2 ran b and d on main. It runs a and c with this PR.Not changed here
bun testexits 0 and silently skips a nonexistent./-prefixed path when another path matches #44002) makes a missing path an error.>, still fails. A release build exits 1 witherror: ModuleNotFound resolving "<cwd>/\0.\0/\0b..."and runs no test. Peak memory grows with lines times files: 38 MB, 71 MB, 198 MB for 200, 400, 800 lines in a folder of as many files. A debug build panics withZStr::as_cstr: interior NUL would truncate the C view.open. resolver, process.dlopen: do not open a path that contains a null byte #43341 (open) refuses such a path. I sent the UTF-16 repro to that work.src/lint/driver/fmt/editorconfig.rs:370,src/install/migration.rs:385,src/install/yarn.rs:248,src/install/PackageManager/patchPackage.rs:591,src/runtime/webview/ChromeProcess.rs:1133.docs/test/discovery.mdxnames no encoding for the list.Self-review concerns not taken
BufferofEF BB BF. The tests fail without the fix, which shows the bytes are on disk.